package com.cwiyc.orderonlineback.controller;

import com.cwiyc.orderonlineback.common.Result;
import com.cwiyc.orderonlineback.entity.Meal;
import com.cwiyc.orderonlineback.service.MealServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping
public class MealController {

    @Autowired
    MealServiceImpl mealService;

    @PostMapping("/getmeal")
    public Result<?> getMeal(@RequestBody Meal meal) {
        return mealService.getMeal(meal);
    }

    @GetMapping("/getmealbycode")
    public Result<?> getMealByCode(@RequestParam String code){return mealService.getMealByCode(code);}

    @PostMapping("/deletemeal")
    public Result<?> deleteMeal(@RequestBody Integer mid) {
        return mealService.deleteMeal(mid);
    }

    @PostMapping("/insertmeal")
    public Result<?> insertMeal(@RequestBody Meal meal) {
        return mealService.insertMeal(meal);
    }

    @PostMapping("/modifymeal")
    public Result<?> modeifyMeal(@RequestBody Meal meal) {
        return mealService.modeifyMeal(meal);
    }
}
